package com.lzy.cloud.goods.service.GoodsServiceImpl;

import com.lzy.cloud.goods.dtos.CarDraftDto;
import com.lzy.cloud.goods.entity.CarDraft;
import com.lzy.cloud.goods.mapper.CarDraftMapperExt;
import com.lzy.cloud.goods.service.CarDraftService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by WIN7 on 2018/6/13.
 */
@Service
public class CarDraftServiceImpl implements CarDraftService{

    @Autowired
    CarDraftMapperExt carDraftMapperExt;

    @Override
    public Boolean add(CarDraftDto dto) {
        return carDraftMapperExt.insertSelective(DozerUtils.map(dto, CarDraft.class))>0;
    }

    @Override
    public Boolean del(Long id) {
        return carDraftMapperExt.deleteByPrimaryKey(id)>0;
    }

    @Override
    public Boolean update(CarDraftDto dto) {
        return carDraftMapperExt.updateByPrimaryKeySelective(DozerUtils.map(dto,CarDraft.class))>0;
    }

    @Override
    public List<CarDraftDto> selectList(CarDraftDto draftDto) {
        return carDraftMapperExt.selectList(draftDto);
    }
}
